# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=odbc-cpp-wrapper
pkgver=1.1
pkgrel=1
pkgdesc="An object-oriented C++-wrapper of the ODBC API"
url="https://github.com/SAP/odbc-cpp-wrapper"
arch="all"
license="Apache-2.0"
makedepends="
	cmake
	gtest-dev
	samurai
	unixodbc-dev
	"
subpackages="$pkgname-static $pkgname-dev"
source="odbc-cpp-wrapper-$pkgver.tar.gz::https://github.com/SAP/odbc-cpp-wrapper/archive/refs/tags/v$pkgver.tar.gz
	10_soversion.patch"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DODBCCPP_VERSION=$pkgver \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
711344b8e2c416058ac7e8d84214cdd9356e6f97ee6cd402fccde4609fbef6a2093f9bc0585fc62c22a6fea2fc78e24148cb41ff6aeb000ffbd3a1e4e04ca8e9  odbc-cpp-wrapper-1.1.tar.gz
49d88fb796b90669762d0bcdef83cbbf92c77629cc448087706834d396ec0b4f9bdc7d1b4bf25295d3329792f871908efe805665168dccc64972d65fcaa92382  10_soversion.patch
"
